<section id="main-content">
	<section class="wrapper">
		<!--state overview start-->
		<div class="row">
			<div class="col-lg-12">
				<section class="panel">
					<header class="panel-heading">
						日志列表
					</header>
					<div class="panel-body">
						<div class="row">
							<div class="input-group m-bot15">
								<span class="input-group-addon" style="position: relative;z-index: 2;">年份</span>
								<select class="form-control"
										style="position: relative;"
										id="pyear">
									<option value="2019">2019</option>
									<option value="2020">2020</option>
									<option value="2021">2021</option>
									<option value="2022">2022</option>
									<option value="2023">2023</option>
								</select>

								<span class="input-group-addon" style="position: relative;z-index: 2;">月份</span>
								<select class="form-control"
										style="position: relative;"
										id="pmonth">
									<option value="0" selected="true">请选择月份</option>
									<option value="01">1</option>
									<option value="02">2</option>
									<option value="03">3</option>
									<option value="04">4</option>
									<option value="05">5</option>
									<option value="06">6</option>
									<option value="07">7</option>
									<option value="08">8</option>
									<option value="09">9</option>
									<option value="10">10</option>
									<option value="11">11</option>
									<option value="12">12</option>
								</select>
							</div>
						</div>
						<div class="row">
							<div class="col-lg-3">
								<button class="btn btn-primary s1"><i class="icon-time"></i> 未填写进展项目</button>
							</div>
							<div class="col-lg-3">
								<button class="btn btn-primary s2"><i class="icon-time"></i> 资产折旧</button>
							</div>
							<div class="col-lg-3">
								<button class="btn btn-primary s3"><i class="icon-time"></i> 各阶段出差报销</button>
							</div>
							<div class="col-lg-3">
								<button class="btn btn-primary s4"><i class="icon-time"></i> 当天实际未分配工作成本</button>
							</div>
						</div>
						<br/>
						<div class="row">
							<div class="col-lg-3">
								<button class="btn btn-primary s5"><i class="icon-time"></i> 当天预测未分配工作成本</button>
							</div>
							<div class="col-lg-3">
								<button class="btn btn-primary s6"><i class="icon-time"></i> 生成下个月每天剩余预测工作量</button>
							</div>
							<div class="col-lg-3">
								<button class="btn btn-primary s7"><i class="icon-time"></i> 前三个星期实际剩余工作量</button>
							</div>
							<div class="col-lg-3">
								<button class="btn btn-primary s8"><i class="icon-time"></i> 前三个星期预测剩余工作量</button>
							</div>
						</div>
						<div class="row" style="margin-top: 19px;">
							<div class="col-lg-3">
								<button class="btn btn-primary s9"><i class="icon-time"></i> 人天和成本</button>
							</div>
						</div>
						<br/>
						<div id="logContainer" class="dlshouwen-grid-container"></div>
						<div id="logToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>
					</div>
				</section>
			</div>
		</div>
	</section>
</section>
<script type="text/javascript">
	function findOpmt($scope, CertusFormAjax) {
	    $("#pyear").val(new Date().getFullYear());

		$(".s1").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "1" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s2").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "2" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s3").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "3" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s4").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "4" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s5").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "5" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s6").on('click', function () {
		    var date = new Date();
		    var nowYear = date.getFullYear();
		    var pmonth = $("#pmonth").val();
		    if (pmonth!=0){
                if (nowYear>$("#pyear").val()){
                    layer.msg("必须大于当前日期");
                    return;
                }
                var nowMonth = date.getMonth()+1;
                if (nowMonth>=pmonth){
                    layer.msg("必须大于当前日期");
                    return;
                }
			}
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "6","pmonth":pmonth,"pyear":$("#pyear").val() }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s7").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "7" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});
		$(".s8").on('click', function () {
			// 开启
			var index = layer.load(1);
			CertusFormAjax.ajax('testTimer', { "code": "8" }, function () {
				findLogs();
				//关闭
				layer.close(index);
				layer.msg("执行成功");
			});
		});

        $(".s9").on('click', function () {
            // 开启
            var index = layer.load(1);
            CertusFormAjax.ajax('testTimer', { "code": "9" }, function () {
                findLogs();
                //关闭
                layer.close(index);
                layer.msg("执行成功");
            });
        });

		this.findLogs = function () {
			var colums = [{
				id: 'timerTaskResults',
				title: '日志内容',
				type: 'string',
				columnClass: 'text-center'
			}, {
				id: 'createTime',
				title: '创建时间',
				type: 'date',
				format: 'yyyy-MM-dd hh:mm:ss',
				otype: 'time_stamp_ms',
				columnClass: 'text-center',
				width: 110
			}];

			$("#logContainer").empty();
			$("#logToolBarContainer").empty();
			CertusFormAjax.ajax('findLogs', {}, function (response) {
				var leaInfoOption = {
					lang: 'zh-cn',
					ajaxLoad: false,
					// loadURL:'url',
					exportFileName: '日志列表',
					datas: response.data,
					columns: colums,
					gridContainer: 'logContainer',
					toolbarContainer: 'logToolBarContainer',
					tools: '',
					extraWidth: 20,
					pageSize: 20,
					pageSizeLimit: [20, 30, 50]
				};
				var leaInfoGrid = $.fn.dlshouwen.grid.init(leaInfoOption);
				leaInfoGrid.load();
			});
		}
		findLogs();
	}
</script>